<% active_record_attrs = @controller_name.singularize.constantize.attribute_names.delete_if { |item| ['id', 'created_at', 'updated_at'].include? item } rescue [] -%>
<table class="table table-bordered table-striped">
  <thead>
  <tr>
    <% active_record_attrs.each do |item| -%>
    <td></td>
    <% end -%>
  </tr>
  </thead>
  <%% @<%= @controller_file_name.singularize %>.each do |item| %>
  <tr>
    <% active_record_attrs.each do |column_name| -%>
    <td>
      <%%= item.<%= column_name %> %>
    </td>
    <% end -%>
    <td>
      <%%= link_to '编辑', {action: 'edit', id: item.id} %>
      |
      <%%= link_to '删除', {action: 'destroy', id: item.id}, method: :delete, data: {confirm: '确定删除?'} %>
    </td>
  </tr>
  <%% end %>
</table>

<%%= paginate @<%= @controller_file_name.singularize %> %>

